import java.util.*;

public class Main2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        List<Long> list = new ArrayList<>();
        while (m > 0) {
            m--;
            int code = sc.nextInt();
            long len = sc.nextLong();
            if (code == 1) {
                //放木材
                if (list.contains(len)) {
                    System.out.println("Already Exist");
                } else {
                    list.add(len);
                    Collections.sort(list);
                }
            } else {
                //取木材
                if (list.size() == 0) {
                    System.out.println("Empty");
                    continue;
                }
                if (list.contains(len)) {
                    System.out.println(len);
                    list.remove(len);
                } else {
                    int px = 0; //len 的偏移量
                    while (!list.contains(len + px) && !list.contains(len - px)) {
                        px++;
                    }
                    if (list.contains(len - px)) {
                        System.out.println(len - px);
                        list.remove(len - px);
                    } else {
                        System.out.println(len + px);
                        list.remove(len + px);
                    }
                }
            }
        }
        sc.close();
    }
}
